LeakyReLu ================= Leaky ReLU激活函数。 该激活函数定义如下: .. math:: leaky\_relu(x) = \begin{cases} x, & \text{if } x \geq 0; \\ \alpha \cdot x, & \text{otherwise.} \end{cases} 其中, :math:`\alpha` 表示 alpha 参数。 输入: - **input** - 输入数据的地址。 - **elem_cnt** - 计算长度。 - **alpha** - 公式中的alpha参数。 - **core_mask** - 核掩码。 输出: - **output** - 输出地址。 支持平台: ``FT78NE`` ``MT7004`` .. note:: - FT78NE 支持int8, fp32 - MT7004 支持fp16, fp32 **共享存储版本:** .. c:function:: void fp_leaky_relu_s(float* input, float* output, int elem_cnt, float alpha, int core_mask) .. c:function:: void hp_leaky_relu_s(half* input, half* output, int elem_cnt, half alpha, int core_mask) .. c:function:: void i8_leaky_relu_s(const int8_t* input, int8_t* output, int elem_cnt, float alpha, int core_mask) **C调用示例:** .. code-block:: c :linenos: :emphasize-lines: 7 void main() { float* input = (float*)0x82000000; float* output = (float*)0x88000000; int length = 1000; float alpha = 0.9; int core_mask = 0b1111; fp_leaky_relu_s(input, output, length, alpha, core_mask); } **私有存储版本:** .. c:function:: void fp_leaky_relu_p(float* input, float* output, int elem_cnt, float alpha, int core_mask) .. c:function:: void hp_leaky_relu_p(half* input, half* output, int elem_cnt, half alpha, int core_mask) .. c:function:: void i8_leaky_relu_p(const int8_t* input, int8_t* output, int elem_cnt, float alpha, int core_mask) **C调用示例:** .. code-block:: c :linenos: :emphasize-lines: 7 void main() { float* input = (float*)0x10000000; // 私有存储版本地址设置在AM内 float* output = (float*)0x10010000; int length = 1000; float alpha = 0.9; int core_mask = 0b0001; // 私有存储版本只能设置为一个核心启动 fp_leaky_relu_p(input, output, length, alpha, core_mask); }